<template>
  <el-dialog
    title="订单详细信息"
    :visible.sync="dialogVisible"
    width="60%"
    :before-close="handleClose"
  >
  </el-dialog>
</template>

<script>
import {getDetailOrder,lendOrder} from "@/api/oms/order";

export default {
  name: "orderLend",
  props: {
    orderId: {
      type: String,
      default: ''
    },
    lendFormVisible: false
  },
  data() {
    return {
      lendCheckForm: {
        carId: '',
        description: "",
        lendDate: "",
        orderId: '',
        surplusEnergy: ""
      },
    }
  },
  mounted() {
    this.getOrderDetail(this.orderId)
  },
  methods: {
    getOrderDetail(orderId) {
      console.log('拿到id了', orderId)
      if (orderId !== '') {
        getDetailOrder(orderId).then(res => {
          this.lendCheckForm.carId=res.data.order.carId
        })
      }
    },
    addLendCheck() {
      lendOrder(this.lendCheckForm).then((res)=>{
        this.$message.success("出车信息提交成功")
      })
    },
    handleClose(done) {
      this.carInfo = ''
      this.reset()
      console.log('取消操作')
      this.$emit('changeShow')
    },
    reset() {
      this.lendCheckForm={}
    }
  }
}
</script>

<style scoped>

</style>
